Lab: motions and text objects agenda * motions * commands * vim additions * help pages * discussion # vi motions 0 start of line ^ start of line $ end of line # word motions [a-zA-Z0-9_] w next word b previous word e end of word # WORD motions (based on whitespace) W next WORD B previous WORD E end of WORD # character based motions f[char] forward to [char] (inclusive), mnemonic forward t[char] forward to [char] (exclusive), mnemonic up to ; next match , previous match # text object motions { previous paragraph } next paragraph % matching pair of ()[]{} # combine motions with commands dw delete word cw change word yw yank word # some examples d0 d^ d$ dw dW df. dt( d% d{ d} dG ############ # vim only # ############ # vim motions shift-left word right (b) shift-right word left (w) F backwards to character inclusive T backwards to character exclusive ge backwards to end of word gE backwards to end of WORD # additional command combinations dgg delete from cursor to document start d) delete sentence d delete from cursor to beginning of line d> delete from cursor to end of line # commands to change case g~ invert case gu lower case gU upper case # command applied to a single line gUU guu g~~ # change case with motion g~w guw gUW # vim text objects ciw caw change word [a-zA-Z0-9_] ciW caW change WORD (based on whitespace) cip cap change paragraph ci' ca' change '' contents ci" ca" change "" contents ci[ ca[ change [] contents ci( ca( change () contents ci{ ca{ change {} contents # help :help motion :help motion.txt :help text-objects # ways to use a motion [count][command][motion] [command][count][motion] [command][motion] [count][motion] [motion]